<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="${base}/" />
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
</head>
<script src="js/jquery-3.5.0.js"></script>
<script src="layer/layer.js"></script>
<script>
	$(function(){
		$("#btnsubmit").click(function(){
			//获取值
			let pwd = {
				"opr":"updatePwd",
				"oldPwd":$("#oldpwd").val(),
				"newpwd":$("#newpwd").val()
			}
			
			$.ajax({
				url:"Adminservlet",
				type:"post",
				data:pwd,
				dataType:"json",
				success:function(result){
					if(result.code==200){
						layer.msg("修改成功,请重新登录")
						setTimeout(function(){
							window.open("login.jsp","_top")
						},"2000")
					}else if(result.code==101){
						layer.alert("密码错误")
					}else{
						layer.alert("系统维护中")
					}
				}
			})
		})
	})
</script>
<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>管理员密码修改</strong>
		</div>
		<div class="padding border-bottom">
			<button type="button" class="button border-yellow" onclick="toList()">
				<span class="icon-plus-square-o"></span>放弃修改
			</button>
		</div>
		<div class="body-content">
			<form method="post" class="form-x" action="">
				
				<div class="form-group">
					<div class="label">
						<label>原密码：</label>
					</div>
					<div class="field">
						<input type="password" id="oldpwd" class="input w50"
							placeholder="请输入原密码" name="name" value="" />
						<div class="tips" id="text1">${msg1}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>密码：</label>
					</div>
					<div class="field">
						<input type="password" id="newpwd" class="input w50"
							placeholder="请输入新密码" name="pwd" value="" />
						<div class="tips" id="text2">${msg2}</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>确认密码：</label>
					</div>
					<div class="field">
						<input type="password" id="repwd" class="input w50"
							placeholder="请确认密码" name="repwd" value="" />
						<div class="tips" id="text3">${msg3}</div>
					</div>
				</div>
						
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" id="btnsubmit" type="button">
							提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>